odoo.define('uppper_right_menu', function (require) {
    "use strict";
    var UserMenu = require('web.UserMenu');
    UserMenu.include({
         start: function () {
            var self = this;
            var session = this.getSession();
            if (!session.is_system) {
                var db_manager = this.$el.find('[data-menu="dbmanager"]')[0];
                db_manager.remove();
            }
            return this._super.apply(this, arguments);
        },
        _onMenuDbmanager: function () {
            window.open('/web/database/manager', '_self');
        },
        _onMenuUserinfo: function () {
            var self = this;
            var session = this.getSession();
            this.trigger_up('clear_uncommitted_changes', {
                callback: function () {

                    self._rpc({
                        model: "res.users",
                        method: "action_get_user",
                        args: [session.uid],
                    })
                        .then(function (result) {
                            // result.res_id = session.uid;
                            self.do_action(result);
                            // location.reload();
                        });

                },
            });
        },
    // ----------------------------------------------------
        _onMenuHrinfo: function () {
            // var self = this;
            // var session = this.getSession();
            // this.trigger_up('clear_uncommitted_changes', {
            //     callback: function () {
            //
            //         self._rpc({
            //             model: "res.users",
            //             method: "action_get_hrinfo",
            //             args: [session.uid],
            //         })
            //             .then(function (result) {
            //                 // result.res_id = session.uid;
            //                 self.do_action(result);
            //                 // location.reload();
            //             });

            //     },
            // });
        },
    });

});